package co.baiku.boot.wechat.response;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Author wushuaifei
 * @Date 2021/7/28 下午5:50
 */

public class WxNotifyV3Response implements Serializable {

    private String code;

    private String message;

    private static final transient String FAIL = "FAIL";

    private static final transient String SUCCESS = "SUCCESS";

    public WxNotifyV3Response() {
    }


    public static WxNotifyV3Response success(String message){
        WxNotifyV3Response response = new WxNotifyV3Response();
        response.setCode(SUCCESS);
        response.setMessage(message);
        return response;
    }

    public static WxNotifyV3Response fail(String message){
        WxNotifyV3Response response = new WxNotifyV3Response();
        response.setCode(FAIL);
        response.setMessage(message);
        return response;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean isSuccess(){
        return SUCCESS.equals(this.code);
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WxNotifyV3Response that = (WxNotifyV3Response) o;
        return Objects.equals(code, that.code) && Objects.equals(message, that.message);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, message);
    }
}
